<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use yii\helpers\Url;
use common\models\member\Member;
/* @var $this yii\web\View */
/* @var $searchModel common\models\meeting\MeetingSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', '签到列表');
$this->params['breadcrumbs'][] = $this->title;
?>
<?php $this->beginBlock('siderbar'); ?>
<?= $this->render('//layouts/cms-menu') ?>
<?php $this->endBlock(); ?>
<div class="meeting-index">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <!--?= Html::a(Yii::t('app', '新增'), ['create'], ['class' => 'btn btn-success']) ?>
        <button class="btn btn-danger" id="alldel" type="button">删除</button>-->
    </p>
    <?= GridView::widget([
            'id' => "myform",
            'pjax'=>false,
            'dataProvider' => $dataProvider,
            'filterModel' => $searchModel,
            'containerOptions'=>['style'=>'overflow: auto'], // only set when $responsive = false
            'headerRowOptions'=>['class'=>'kartik-sheet-style'],
            'filterRowOptions'=>['class'=>'filters'],
            'panel'=>[
                'heading'=>'<h3 class="panel-title"><i class="glyphicon glyphicon-globe"></i> 数据列表</h3>',
                'type'=>'default',
                'footer'=>false
            ],
            'toolbar' => [],
            'pager'=>[
                'options'=>['class'=>'hidden']//关闭自带分页
            ],
            'persistResize'=>false,

            'columns' => [
                [
                'class'=>'kartik\grid\CheckboxColumn',
                'headerOptions'=>['class'=>'my-table'],
                ],
                'id',
               [
                    'attribute' => 'username',
                    'value' => function ($model) {
                        $name = Member::findOne(['id'=>$model->member_id]);
                        return $name->username;
                    },
                ],
                
                // 'updated_at',
                // 'starttime',
                // 'endtime',
    
                [
                    'class' => 'yii\grid\ActionColumn',
                    'header' => '操作', 
                    'template' => '{viewsign}',
                    'headerOptions' => ['width' => '200'],
                    'buttons' => [
                        'viewsign' => function ($url, $model, $key) {
                            return  Html::a('&nbsp;&nbsp;<span class="glyphicon glyphicon-eye-open" ><span class="classformat">查看</span></span>', $url, ['title' => '查看'] ) ;
                        },
                    ],
                ],
            ],
        ]); ?>
</div>
<?php $this->beginBlock('footer_scripts'); ?>
<script>
 $(document).ready(function(){
    binddel("<?php echo Url::to(['Meeting/alldelete']);?>");
});
</script>
<?php $this->endBlock(); ?>